using System;
using System.Collections.Generic;
using System.Text;

namespace DDW
{
	public class CharPrimitive : LiteralNode
	{
		public CharPrimitive(char value)
		{
			this.value = value;
		}
		public CharPrimitive(string value)
		{
			if (value.Length == 1)
			{
				this.value = value[0];
			}
			else
			{
				throw new FormatException("char primitive value is not a char");
			}
		}

		private char value;
		public char Value
		{
			get { return this.value; }
		}

		public override void ToSource(StringBuilder sb)
		{
			sb.Append("'" + value + "'");
		}
	}
}
